﻿// MyDemo.cpp : 定义应用程序的入口点。
//

#include "stdafx.h"
#include "MyMainWindow.h"
#include "LoginWindow.h"

#include "TrainTicketModule.h"


void InitResource(HINSTANCE hInstance)
{
	CPaintManagerUI::SetInstance(hInstance);

	CPaintManagerUI::SetResourceType(UILIB_FILE);

	CDuiString strResourcePath = CPaintManagerUI::GetInstancePath();
	strResourcePath += _T("skin\\MyDemo\\");
	CPaintManagerUI::SetResourcePath(strResourcePath.GetData());

	CResourceManager::GetInstance()->LoadResource(_T("res.xml"), NULL);
}

int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
                     _In_opt_ HINSTANCE hPrevInstance,
                     _In_ LPWSTR    lpCmdLine,
                     _In_ int       nCmdShow)
{
	HRESULT Hr = ::CoInitialize(NULL);
	if (FAILED(Hr))
	{
		return 0;
	}

	
	InitResource(hInstance);

	LoginWindow::Instance()->Show();


	/*
	MyMainWindow* pMainWindow = new MyMainWindow();
	if (pMainWindow == NULL)
	{
		return 0;
	}

	pMainWindow->SetTrainTicketModule(new TrainTicketModule());

	pMainWindow->InitResource();
	pMainWindow->Create(NULL, _T("MyDemo"), UI_WNDSTYLE_FRAME, 0L, 0, 0, 990, 690);
	pMainWindow->CenterWindow();
	pMainWindow->ShowModal();

	delete pMainWindow;
	*/

	CPaintManagerUI::MessageLoop();

	::CoUninitialize();
	return 0;
}


